<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of EmpresaDAO
 *
 * @author emmanuelm
 */
class EmpresaDAO {
    private $dsn = "mysql:host=localhost;port=3306;dbname=aet_teste";
    private $user = "root";
    private $senha = "";
    
    public function getDsn() {
        return $this->dsn;
    }

    public function getUser() {
        return $this->user;
    }

    public function getSenha() {
        return $this->senha;
    }

       
        public function Insere(Empresa $empresa){
        try{
            $con = new PDO($this->getDsn(),$this->user,$this->senha);
            $con-> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            $con-> exec("set names utf8");	

            $st = $con->prepare("INSERT INTO empresa(emp_cnpj_cpf,emp_email,emp_senha) VALUES(?, ?, ?)");
            $st-> bindValue(1,$empresa->getEmp_cnpj_cpf());
            $st-> bindValue(2,$empresa->getEmp_email());
            $st-> bindValue(3,$empresa->getEmp_senha());
            $st-> execute();
        }  
        catch (Exception $e){
            return $e->getMessage();            
        }	
    }
    function __construct() {
        
    }
    
    
    
}


?>
